using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace LogAnalyzer.Dialogs
{
    public partial class NewViewer : Form
    {

        public NewViewer()
        {
            InitializeComponent();
            Text = Globalization.ResourceManager.Current.GetString("NEW_VIEWER");
            grpGrabberList.Text = Globalization.ResourceManager.Current.GetString("CHOOSE_GRABBER");

            lstGrabbers.Items.Add(Globalization.ResourceManager.Current.GetString("FILE_SYSTEM"));
            lstGrabbers.Items.Add(Globalization.ResourceManager.Current.GetString("SERIAL_PORT"));
            lstGrabbers.Items.Add(Globalization.ResourceManager.Current.GetString("SOCKET"));
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
        }

        public string SelectedGrabberType
        {
            get
            {
                switch (lstGrabbers.SelectedIndex)
                {
                    case 0:
                        return "LogAnalyzer.Grabbers.FileGrabber";

                    case 1:
                        return "LogAnalyzer.Grabbers.SerialPortGrabber";

                    case 2:
                        return "LogAnalyzer.Grabbers.SocketGrabber";

                    default:
                        return null;

                }
            }
        }

        private void lstGrabbers_DoubleClick(object sender, EventArgs e)
        {
            if (lstGrabbers.SelectedIndex > -1)
            {
                btnOk_Click(null, null);
            }
        }
        

    }
}